package cn.lsnu.modules.check.service;

import cn.lsnu.common.interfacetools.interfaceentity.Page;
import cn.lsnu.common.interfacetools.interfaceservice.BaseService;
import cn.lsnu.modules.check.entity.InnerCheckEntity;
import cn.lsnu.modules.check.mapper.InnerCheckMapper;
import cn.lsnu.utils.Guuid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class InnerCheckService extends BaseService<InnerCheckEntity,InnerCheckMapper> {

    @Autowired
    private InnerCheckMapper innerCheckMapper;

    @Override
    public void save(InnerCheckEntity entity) throws Exception {
        entity.setCheckDate(new Date());
        super.save(entity);
    }

    @Override
    public InnerCheckEntity get(String key) throws Exception {
        return super.get(key);
    }

    @Override
    public InnerCheckEntity getEntity(InnerCheckEntity entity) throws Exception {
        return super.getEntity(entity)== null?new InnerCheckEntity():super.getEntity(entity);
    }

    @Override
    public List<InnerCheckEntity> findList(InnerCheckEntity entity) throws Exception {
        return super.findList(entity);
    }

    @Override
    public Page<InnerCheckEntity> findPage(InnerCheckEntity entity) throws Exception {
        return super.findPage(entity);
    }

    @Override
    public void delete(InnerCheckEntity entity) throws Exception {
        super.delete(entity);
    }

    @Override
    public void update(InnerCheckEntity entity) throws Exception {
        entity.setCheckDate(new Date());
        super.update(entity);
    }

    public InnerCheckEntity getInner(String key) throws Exception{
       return innerCheckMapper.getInner(key);
    }
}
